# 存放页面的公共方法
from selenium.webdriver.support.wait import WebDriverWait


class Base:
    def __init__(self,driver):
        self.driver=driver
    # 1.查找元素
    def base_find_element(self,loc,timeout=10,poll_frequency=0.5):
        return WebDriverWait(self.driver,timeout,poll_frequency).until(lambda x:x.find_element(loc[0],loc[1]))

    # 2.输入方法
    def base_input(self,loc,value):
        el=self.base_find_element(loc)
        el.clear()
        el.send_keys(value)

    # 3.点击方法
    def base_click(self,loc):
        self.base_find_element(loc).click()

    # 4.获取文本值
    def base_get_text(self,loc):
        return self.base_find_element(loc).text